﻿using System;
using ZoneFiveSoftware.Common.Data;
using ZoneFiveSoftware.Common.Data.Fitness;

namespace FilteredStatistics.Common
{
    // This interface is used to cache some information on a certain range.
    //  Since there are many different algorithms to remove pauses and I want
    //  to use mine for consistency across plugins, I provide all the information
    //  within an object that implements this interface.  You will find all the
    //  information relative to this range within this object so use the provided
    //  data track in your computations.
    interface IActivityRangeInfoCache
    {
        IActivity Activity { get; }
        ActivityInfo ActivityInfo { get; }

        // Methods to allow other plugins to cache some data.  This allows us to
        //  prevent recomputing stuff too often.  Every row in the result table
        //  contains a single instance of this class.
        bool ContainsStoredInfo(Guid infoId);
        void SaveStoredInfo(Guid infoId, object data);
        // Returns null if the info isn't available
        object RetrieveStoredInfo(Guid infoId);

        // Range for result, without it's pauses
        ValueRange<DateTime> PauselessRange { get; }

        // Range for the result, with all pauses included
        ValueRange<DateTime> RangeWithPauses { get; }

        // Returns the activity's track with all pauses removed from it.  The
        //  original track can be found in the ActivityInfo (Smoothed???Track...)
        INumericTimeDataSeries ActivityPauselessCadenceTrack { get; }
        INumericTimeDataSeries ActivityPauselessDistanceTrack { get; }
        INumericTimeDataSeries ActivityPauselessElevationTrack { get; }
        INumericTimeDataSeries ActivityPauselessGradeTrack { get; }
        INumericTimeDataSeries ActivityPauselessHeartRateTrack { get; }
        INumericTimeDataSeries ActivityPauselessPowerTrack { get; }
        INumericTimeDataSeries ActivityPauselessSpeedTrack { get; }

        // Returns the range's track with all pauses removed from it
        //  (only data from within the range is in the track)
        INumericTimeDataSeries PauselessRangeCadenceTrack { get; }
        INumericTimeDataSeries PauselessRangeDistanceTrack { get; }
        INumericTimeDataSeries PauselessRangeElevationTrack { get; }
        INumericTimeDataSeries PauselessRangeGradeTrack { get; }
        INumericTimeDataSeries PauselessRangeHeartRateTrack { get; }
        INumericTimeDataSeries PauselessRangePowerTrack { get; }
        INumericTimeDataSeries PauselessRangeSpeedTrack { get; }

        // Returns the range's track with all pauses included (only
        //  data from within the range is in the track)
        INumericTimeDataSeries RangeWithPausesCadenceTrack { get; }
        INumericTimeDataSeries RangeWithPausesDistanceTrack { get; }
        INumericTimeDataSeries RangeWithPausesGradeTrack { get; }
        INumericTimeDataSeries RangeWithPausesElevationTrack { get; }
        INumericTimeDataSeries RangeWithPausesHeartRateTrack { get; }
        INumericTimeDataSeries RangeWithPausesPowerTrack { get; }
        INumericTimeDataSeries RangeWithPausesSpeedTrack { get; }
    }
}
